package com.example.fableoid;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Selector extends ListActivity {
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.selector);
		
		ListView listView = (ListView) findViewById(android.R.id.list);
		 // storing string resources into Array
        String[] story_titles = getResources().getStringArray(R.array.story_list);
 
        // Binding resources Array to ListAdapter
        
        ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,android.R.layout.simple_list_item_1,android.R.id.text1,story_titles);
        
        listView.setAdapter(adapter);
	}
                  
        
        	public void onListItemClick(ListView parent,View view, int position, long id) {
        		
        		String title = ((TextView) view).getText().toString();
                // Launching new Activity on selecting single List Item
                Intent i = new Intent(Selector.this, Descriptor.class);
                i.putExtra("title", title);
                // sending data to new activity
                startActivity(i);
        	}
			
        
        	

			
			
        
        
	
	
	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }


}
